import store from './store/index.js'
//app.js
App({
  onLaunch(){
    this.setCartcount()
    store.subscribe(this.setCartcount)
  },
  setCartcount() {
    const text = store.getState().cart.cart.reduce((result, item) => {
      result += item.count
      return result
    }, 0).toString();
    console.log(text)
      wx.setTabBarBadge({
        index: 2,
        text
      })
      
  }
})